package com.qire.manhua.model.vo;

import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableStringBuilder;

import com.qire.common.collect.ArrayUtil;
import com.qire.manhua.view.style.RadiusBackgroundSpan;

public class ComicRankListOfHotVO {
    public ComicRankListItemVO[] list;  //: [],
    public String notice;               //: "下次放榜时间：02月10日(星期三) 11:00"

    public class ComicRankListItemVO {
        public int      id;               //: 10057,
        public String   book_name;        //: "不嫁总裁嫁男仆",
        public String   book_author;      //: "万画筒漫画",
        public String   book_unruly;      //: "https://p.qiremanhua.com/uploads/book/201906/5d0c4f8360268.jpg?x-oss-process=image/quality,q_90/format,webp",
        public String   short_title;      //: "她未婚夫被抢，一夜间身败名裂",
        public int      end_state;        //: 1,
        public int      chapter_px;       //: 270,
        public int      read_cnt;         //: 370076423,
        public String[] tags;             //: ["恋爱","总裁","都市"],
        public int      teenager;         //: 1

        public CharSequence comicLabel() {
            SpannableStringBuilder builder = new SpannableStringBuilder();
            if(ArrayUtil.notEmpty(tags)) {
                for (String label : tags) {
                    int startIndex = builder.length();
                    builder.append(label + " ");
                    RadiusBackgroundSpan bgSpan = new RadiusBackgroundSpan(Color.rgb(0x99, 0x99, 0x99), 6);
                    builder.setSpan(bgSpan, startIndex, startIndex + label.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
                }
            }
            return  builder;
        }
    }
}
